#include <stdio.h>
#include <pthread.h>

void* task(void *p)
{
	char *s = "abcd";	//right , point to constant sector
//	char s[] = "abcd";	//wrong , point to stack
	return s;		//Can't return the addr of local variable
}

void* task1(void *p)
{
	static int sum = 9;	//It allows to return variable of type static
	return &sum;
}

int main()
{
	pthread_t id,id1;
	char *st ;
	pthread_create(&id , 0, task , 0);
	pthread_join(id,(void **)&st);
	printf("s = %s\n",st);
	int *num ;
	pthread_create(&id1 , 0, task1 , 0);
	pthread_join(id1,(void *)&num);
	printf("num = %d\n",*num);
		
}
